// part1:C09:ex9.49.cpp
// ascender and descender.
#include <iostream>
#include <fstream>
#include <string>
using namespace std;

void find_longest_word(ifstream& in) {
  string s1, longest_w;
  int max_len = 0;
  while (in >> s1) {
    if (max_len < s1.size()) {
      max_len = s1.size();
      longest_w = s1;
    }
  }
  cout << endl << "longest word is : " << longest_w << endl;
}

int main(int argc, char *argv[]) {
  ifstream in(argv[1]);
  if (!in) {
    cerr << "could not open input file!" << endl;
    exit(1);
  }

  find_longest_word(in);

  return 0;
}
